/* *
 * @program: VideoDirector
 *
 * @description: ${description}
 *
 * @author: 909845
 *
 * @create: 2019-03-12 20:07
***/

#ifndef VIDEODIRECTOR_FLVREMUX_H
#define VIDEODIRECTOR_FLVREMUX_H

#include <Common/Common.h>
#include <media/flv-muxer.h>
#include "../Public/StreamBuffer.h"
#include "../Public/MyTimer.h"
#include "IRemuxInterface.h"
#include "PacketFlv/H264AacToFlv.h"

class CFlvRemux:public IRemuxInterface, public IFlvStream
{
public:
    CFlvRemux(const string &strTaskID);

    virtual ~CFlvRemux();

public://IRemuxInterface
    virtual Bool Initlize(const FuncRemuxStreamCb remuxStreamCb, bool bHaveAudio) override;

    virtual void RecvVideoStream(const char *pData, int nLen, unsigned int uTimestamp) override;

    virtual void RecvAudioStream(const char *pData, int nLen, unsigned int uTimestamp) override;

private:// IFlvStream
    virtual void OnFlvStream(const char *pData, int nLen) override;

private:
    string                                   m_strTaskId;
    FuncRemuxStreamCb                        m_remuxStreamCb = nullptr;
    bool                                     m_bStartSps = false;
    H264AacToFlv                             m_packFlv;
};
#endif //VIDEODIRECTOR_FLVREMUX_H

